var io = require("socket.io").listen(10000);
/* 定义socket连接时执行的回调操作 */
io.on('connection', function (socket) {
    // socket发送消息函数，参数分别为key,data;
    socket.emit('server_event', {msg: 'hello world'});
    // socket.on为socket接收消息函数，参数分别为key,data;
    socket.on('client_event', function(data){
        console.log(data);
        socket.emit('server_event', {msg: 'Message received'});
    });
});